#include"Comm.hpp"
int main()
{
    //1、获取key
    key_t key = GetKey();
    //2、获取共享内存
    int shmid = GetShm(key);
    //3、挂载共享内存
    char* s = (char*)shmat(shmid,nullptr,0);

    std::cout << "Client shmat success-------" << std::endl;
    //4、打开管道文件
    int fd = open(fifoname.c_str(), O_WRONLY);

    //5、给服务端发送消息
    for(char c = 'a';c<='z';c++)
    {
        int code = 0;
        s[c - 'a'] = c;
        std::cout << "write : " << c << std::endl;
        sleep(2);
        write(fd,&code,sizeof(code)); //通知服务端
    }

    //6、解绑共享内存映射
    shmdt(s);
    std::cout << "client shmdt success-------" << std::endl;
    return 0;
}
